<?php
namespace Admin\Controller;
use Tools\AdminController;
class IndexController extends AdminController {
    function index(){
    	$this->display();
    }
	function left(){
		$manager=new \Model\ManagerModel();
		$admin_id=session('admin_id');
		$admin_name=session('admin_name');
		//查找角色id
		$admin_info=D('Manager')->find($admin_id);
		$role_id=$admin_info['roleid'];
		
		//超级管理员显示全部权限
		if($admin_name==='admin'){
			$auth_infoA=D('Auth')->where("level=0")->select();
			$auth_infoB=D('Auth')->where("level=1")->select();
		}else {
		//查找角色权限id
		$role_info=D('Role')->find($role_id);
		$auth_ids=$role_info['authids'];
			//查找权限名称
			//var_dump($role_info);
		$auth_infoA=D('Auth')->where("level=0 and id in ($auth_ids)")->select();
		$auth_infoB=D('Auth')->where("level=1 and id in ($auth_ids)")->select();
		}
		$this->assign('auth_infoA',$auth_infoA);
		$this->assign('auth_infoB',$auth_infoB);
		$this->display();
	}
	
}